<template>
  <div class="app-container">
    <div>前<el-button  type="success"  @click="clear">清空</el-button></div>

<el-input

type="textarea"

class="input-width"

placeholder="最多输入50个字"

maxlength="100000"


:rows="15"


v-model="auditReson"

></el-input>

    <div>后<el-button @click="change()" type="primary">Change</el-button>
    <el-button class="bar_btn copy_btn" :data-clipboard-text="auditReson1" @click="copy">一键复制</el-button>
    </div>
    
    <el-input

type="textarea"

class="input-width"

placeholder="最多输入50个字"

maxlength="100000"

:rows="15"


v-model="auditReson1"

>
</el-input>
  </div>
</template>
<script>
import Clipboard from 'clipboard';
export default {
  // 定义数据模型
  data() {
    return {
      auditReson:"",
      auditReson1:"",
      value:this.auditReson1
    }
  },
  // 页面渲染成功后获取数据
  created() {
   
  },
  // 定义方法
  methods: {
    change() {
      //console.log(this.auditReson)
      let orgin = this.auditReson
      this.auditReson1=this.auditReson.replace(/\d/g,'').replace(/^[\\s&&[^\\n]]*$/g,'').replace( /\n(\n)*( )*(\n)*\n/g,'\n')
    },clear(){
      this.auditReson=""
    },
     copy() {
      var clipboard = new Clipboard(".copy_btn");
      clipboard.on("success", () => {
        this.$message.success('复制成功~')

        // 释放内存
        clipboard.destroy();
      });

      clipboard.on("error", () => {
        // 不支持复制
        this.$message.error('复制失败，请重试')
        // 释放内存
        clipboard.destroy();
      });
    }
  }
}
</script>